<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<form id="pagerForm" method="get" model="viewRequest" action="#rel#">
	<input type="hidden" name="viewRequest.page" value="${page.number}" />
	<input type="hidden" name="viewRequest.size" value="${page.size}" />
	<c:forEach items="${viewRequest.params}" var="params">
		<input type="hidden" id="${params.key}" name="viewRequest.params['${params.key}']" value="${params.value}" />
	</c:forEach>
	<c:forEach items="${viewRequest.sort}" var="sort">
		<input type="hidden" name="viewRequest.sort.${sort.key}" value="${sort.value}" />
	</c:forEach>
</form>

<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return goods_navSearch(this);" action="${rootUrl}/goods/goods/1/dialog" method="get">
	<div class="searchBar">
		<ul class="searchContent" style="height: 75px">
			<li>
				<label>商品名称：</label>
				<input type="text" name="viewRequest.params['g_dot_name_like']" value="${viewRequest.params.g_dot_name_like}"/>
			</li>
			<li>
				<label>商品类别：</label>
				<input type="hidden" id="goodsClassId" name="goodsClass.id" value="${viewRequest.params._and_g_dot_goodsClass_dot_id_eq_string}"/>
				<input type="text" style="float:left" id="goodsClassName" name="goodsClass.name" value="${goodsClassName}"/>
				<a class="btnLook" rel="goods_specS" href="${rootUrl}/goods/goods-class/1/showAll" width="800" height="720" lookupGroup="goodsClass">商品类别</a>
			</li>
			<li>
				<label>品牌：</label>
				<input type="hidden" id="brandId" name="brand.id" value="${viewRequest.params._and_g_dot_brand_dot_id_eq_string}"/>
				<input type="text" style="float:left" id="brandName" name="brand.name" value="${brandName}"/>
				<a class="btnLook" rel="goods_brandS" href="${rootUrl}/goods/brand/0/dialog" width="800" height="720" lookupGroup="brand">品牌</a>
			</li>
			<li style="width: 500px">
				<label>添加时间：</label>
				<input name="viewRequest.params['_and_g_dot_addTime_ge_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_g_dot_addTime_ge_date'] }" placeholder="开始时间"/>
				<input name="viewRequest.params['_and_g_dot_addTime_le_date']" type="text" class="date" size="20" value="${viewRequest.params['_and_g_dot_addTime_le_date'] }" placeholder="结束时间"/>
			</li>
			<li>
				<label>商家：</label>
				<input type="hidden" id="sellerId" name="seller.id" value="${viewRequest.params._and_g_dot_seller_dot_id_eq_string}"/>
				<input type="text" style="float:left" id="sellerName" name="seller.name" value="${sellerName}"/>
				<a class="btnLook" rel="goods_sellerS" href="${rootUrl}/seller/seller/1/dialog" width="800" height="720" lookupGroup="seller">商家</a>
			</li>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
				<%-- <li><a class="button" href="${rootUrl}/goods/goods!search" target="searchDialog" targetType="dialog" parentDialogId="goods" mask="true" title="查询框"><span>高级检索</span></a></li> --%>
			</ul>
		</div>
	</div>
	</form>
</div>
<div class="pageContent">
	<table class="table" targetType="dialog"  width="100%" layoutH="166">
		<thead>
			<tr>
				<th width="30" align="center" >序号</th>
				<th width="140">商品名称</th>
				<th width="110">品牌</th>
				<th width="260">sku</th>
				<th width="100">商家名称</th>
				<th width="60">库存</th>
				<th width="60">销售量</th>
				<th width="120">添加时间</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.content}" var="goods" varStatus="status">
			<tr target="data_id" rel="${goods.id}">
				<td>${status.count}</td>
				<td>${goods.name}</td>
				<td>${goods.brand.name}</td>
				<td>
				<c:forEach items="${goods.goodsSku}" var="goodsSku" varStatus="status2">
					<c:if test="${goodsSku.state !=2 }">
					${status2.count }、<c:if test="${goodsSku.specName !='' }">${goodsSku.specName }</c:if>
					<c:if test="${goodsSku.specName =='' }">空</c:if>
					</c:if>
				</c:forEach></td>
				<td>${goods.seller.name}</td>
				<td>${goods.inventory}</td>
				<td>${goods.salenum}</td>
				<td><fmt:formatDate value="${goods.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
				<td>
					<c:if test="${isSku != '1' }">
				    	<a class="btnSelect" href="javascript:$.bringBack({id:'${goods.id}',name:'${goods.name}'})" title="查找带回">选择</a>
				    </c:if>
				    <c:if test="${isSku == '1' }">
				    	<a title="sku维护" onclick="$.pdialog.reload('${rootUrl}/goods/goods-sku/0/dialog?goodsId=${goods.id}');" href="javascript:void(0);">sku维护</a>
				    </c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
				<option value="${page.size}">${page.size}</option>
				<option value="20">20</option>
				<option value="50">50</option>
				<option value="100">100</option>
				<option value="200">200</option>
			</select>
			<span>条，共${page.totalElements}条 </span>
		</div>
		<div class="pagination" targetType="dialog" totalCount="${page.totalElements}" numPerPage="${page.size}" pageNumShown="10" currentPage="${page.number}"></div>
	</div>
</div>
<script>
	function goods_navSearch(obj){
		$("#goodsClassId").attr("name","viewRequest.params['_and_g_dot_goodsClass_dot_id_eq_string']");
		$("#goodsClassName").attr("name","goodsClassName");
		$("#brandId").attr("name","viewRequest.params['_and_g_dot_brand_dot_id_eq_string']");
		$("#brandName").attr("name","brandName");
		$("#sellerId").attr("name","viewRequest.params['_and_g_dot_seller_dot_id_eq_string']");
		$("#sellerName").attr("name","sellerName");
		
		return dialogSearch(obj);
	}
</script>